import { useEffect, useState } from "react"

export function useLocalStorage(key, defaultValue) {
    const [v, setV] = useState(defaultValue)

    useEffect(() => {
        window.localStorage.setItem(key, v)
    }, [v, key])

    return [v, setV]
}